#pragma once

extern "C" {
#include <stdio.h>                  //printf
#include <sys/types.h>              //open
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>                 //exit
#include <unistd.h>                 //close
#include <sys/ioctl.h>              //ioctl
#include <linux/videodev2.h>
#include <poll.h>                   //poll
#include <string.h>                 //memset
#include <sys/mman.h>               //mmap
#include <signal.h>
#include <sys/types.h>              
#include <sys/socket.h>
#include <arpa/inet.h>

/* 显示屏相关头文件 */
#include <linux/fb.h>
#include <sys/mman.h>
#include <pthread.h>
}

#include <opencv2/opencv.hpp>
#include <iostream>

#define BLACK                       "\e[30;1m"
#define RED                         "\e[31;1m"
#define GREEN                       "\e[32;1m"
#define YELLOW                      "\e[33;1m"
#define BLUE                        "\e[34;1m"
#define PURPLE                      "\e[35;1m"
#define CYAN                        "\e[36;1m"
#define WHITE                       "\e[37;1m"
#define END                         "\033[0m\n"

#define Print_BLACK(fmt,...)        printf(BLACK fmt END,##__VA_ARGS__)
#define Print_RED(fmt,...)          printf(RED fmt END,##__VA_ARGS__)
#define Print_GREEN(fmt,...)        printf(GREEN fmt END,##__VA_ARGS__)
#define Print_YELLOW(fmt,...)       printf(YELLOW fmt END,##__VA_ARGS__)
#define Print_BLUE(fmt,...)         printf(BLUE fmt END,##__VA_ARGS__)
#define Print_PURPLE(fmt,...)       printf(PURPLE fmt END,##__VA_ARGS__)
#define Print_CYAN(fmt,...)         printf(CYAN fmt END,##__VA_ARGS__)
#define Print_WHITE(fmt,...)        printf(WHITE fmt END,##__VA_ARGS__)

#define ERROR(msg)                  do{\
                                        printf("file[%s],func[%s],line[%d]:",__FILE__,__func__,__LINE__);\
                                        perror(RED msg END);\
                                    }while(0);

#define NB_BUFFER                   6
#define WIDTH                       640
#define HEIGHT                      480

#define YUYV
// #define MJPEG
